<!DOCTYPE html>
<html>
<head>
    {include file="../application/common/header.html" /}
</head>

<body>
    <table id="clazz_comprehensive_strengthdg">
        <thead>
            <tr>
                <th data-options="field:'班级类别'">班级类别</th>
                <th data-options="field:'班级'">班级</th>
                <th data-options="field:'班主任'">班主任</th>
                <th data-options="field:'语文实力'">语文实力</th>
                <th data-options="field:'语文名次'">语文名次</th>
                <th data-options="field:'数学实力'">数学实力</th>
                <th data-options="field:'数学名次'">数学名次</th>
                <th data-options="field:'英语实力'">英语实力</th>
                <th data-options="field:'英语名次'">英语名次</th>
                <th data-options="field:'物理实力'">物理实力</th>
                <th data-options="field:'物理名次'">物理名次</th>
                <th data-options="field:'化学实力'">化学实力</th>
                <th data-options="field:'化学名次'">化学名次</th>
                <th data-options="field:'政治实力'">政治实力</th>
                <th data-options="field:'政治名次'">政治名次</th>
                <th data-options="field:'历史实力'">历史实力</th>
                <th data-options="field:'历史名次'">历史名次</th>
                <th data-options="field:'政史实力'">政史实力</th>
                <th data-options="field:'政史名次'">政史名次</th>
                <th data-options="field:'体育实力'">体育实力</th>
                <th data-options="field:'体育名次'">体育名次</th>
                <th data-options="field:'综合实力'">综合实力</th>
                <th data-options="field:'名次'">名次</th>
            </tr>
        </thead>
    </table>
    <div id="clazz_comprehensive_strengthtb">
        <form id="clazz_comprehensive_strengthForm" class="m5">
            <div>
                学期：
                <select class="easyui-combobox" name="termId" id="termId" data-options="width:120,panelHeight:'auto',value:'请选择', editable:false,textField:'学期名称',valueField:'ID',url:'/compent/Util/termList',onSelect:changeTerm"></select>
                <select id="gradeId" class="easyui-combobox" data-options="width:80,panelHeight:'auto', editable:false,url:'/compent/Util/gradeNameList',onSelect:changeGrade"></select>
                <select id="examId" class="easyui-combobox" data-options="width:120,panelHeight:'auto',editable:false"></select>

                <a class="easyui-linkbutton l-btn l-btn-small" data-options="iconCls:'icon-search'" onclick="queryOk('clazz_comprehensive_strength')">查询</a>
                <a class="easyui-linkbutton l-btn l-btn-small" data-options="iconCls:'icon-clear'" onclick="resetForm1('clazz_comprehensive_strength')">重置</a>
                <a class="easyui-linkbutton" href="javascript:void(0)" data-options="iconCls:'icon-save'" onclick="zoutExcel('clazz_comprehensive_strength','/examScore/clazz_comprehensive_strength')">导出为EXCEL</a>
            </div>
        </form>
    </div>
    <script type="text/javascript">
        $(function(){
            var url = "";
            $("#clazz_comprehensive_strengthdg").datagrid({
                url: "/examScore/clazz_comprehensive_strength/pageQuery.html",
                rownumbers:true,
                striped:true,
                border:false,
                pagination:false,
                fitColumns:true,
                fit:true,
                toolbar: '#clazz_comprehensive_strengthtb',
                rowStyler: function(index,row){
                    if(row.实验班==1){
                        return 'background-color:#fcc'
                    }else if(row.实验班==2){
                        return 'background-color:#9cf'
                    }else if(row.实验班==3){
                        return 'background-color:#ff9'
                    }
                }
            })
        })  
        function changeTerm(record){
            var gradeId = $('#gradeId').combobox('getValue');
            loadParam(record.ID,gradeId)
        }
        function changeGrade(record){
            var termId = $('#termId').combobox('getValue');
            loadParam(termId,record.value)
        }
        function loadParam(termId,gradeId) {
            if(!gradeId) return;
            var url="/compent/util/getTermExam?termId="+termId+"&grade="+gradeId;
            $('#examId').combobox('setValue','');
            $('#examId').combobox('reload',url);
        }

        function resetForm1(cf){
            $("#" + cf + "Form")[0].reset();
            $("#" + cf + "Form #termId").combobox('setValue', "请选择");
            $("#" + cf + "Form #gradeId").combobox('setValue', null);
            $("#" + cf + "Form #examId").datebox('setValue', null);
        }
        function queryOk(){
            var examId = $('#examId').combobox('getValue');
            var gradeId = $('#gradeId').combobox('getValue');
            if(examId){
                if(gradeId==1){
                    $('#clazz_comprehensive_strengthdg').datagrid('hideColumn','物理实力').datagrid('hideColumn','物理名次')
                    .datagrid('hideColumn','化学实力').datagrid('hideColumn','化学名次');
                }else if(gradeId == 2) {
                    $('#clazz_comprehensive_strengthdg').datagrid('showColumn','物理实力').datagrid('showColumn','物理名次')
                    .datagrid('hideColumn','化学实力').datagrid('hideColumn','化学名次');
                } else {
                    $('#clazz_comprehensive_strengthdg').datagrid('showColumn','化学实力').datagrid('showColumn','化学名次')
                    .datagrid('showColumn','物理实力').datagrid('showColumn','物理名次');
                }
                $('#clazz_comprehensive_strengthdg').datagrid('load',{examId:examId,gradeId:gradeId});
            }else{
                $.messager.alert('操作提示','请选择考试名称。');
            }
        }
        function zoutExcel(cf, url){
            var examId = $('#examId').combobox('getValue');
            var gradeId = $('#gradeId').combobox('getValue');
            if(examId){
                window.location.href = url+"/exportExcel.html?examId=" + examId+"&gradeId="+gradeId;
            }else{
                $.messager.alert('操作提示','请选择考试名称。');
            }
        }
    </script>
</body>
</html>